<html>
<head><meta charset="utf-8"><title>rust-lang/libz-sys#59 · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html">rust-lang/libz-sys#59</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="185739973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185739973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> JP Sugarbroad <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185739973">(Jan 15 2020 at 20:22)</a>:</h4>
<p>Any thoughts on this? I know this predates Pin, but it seems like there should be a best practice here.</p>



<a name="185740395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185740395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185740395">(Jan 15 2020 at 20:26)</a>:</h4>
<p>A -sys crate is just supposed to be a direct translation of a C API.</p>



<a name="185740418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185740418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185740418">(Jan 15 2020 at 20:26)</a>:</h4>
<p>it does not expose a safe interface. that would be the job of another crate consuming libz-sys</p>



<a name="185746897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185746897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185746897">(Jan 15 2020 at 21:36)</a>:</h4>
<p>in particular I believe this is because you can (generally) only have one libz-sys due to <code>links</code> in Cargo.toml, IIRC, so  you want it to be as thin a wrapper as possible</p>



<a name="185755232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185755232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> JP Sugarbroad <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185755232">(Jan 15 2020 at 23:21)</a>:</h4>
<p>Yes, but now that we have Pin the crate should probably annotate non-movable types, no?</p>



<a name="185755596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185755596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185755596">(Jan 15 2020 at 23:27)</a>:</h4>
<p>I think no, or at least I would not expect it to</p>



<a name="185755615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185755615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185755615">(Jan 15 2020 at 23:27)</a>:</h4>
<p>like most sys crates basically have no "Rust" types in them</p>



<a name="185755618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185755618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185755618">(Jan 15 2020 at 23:27)</a>:</h4>
<p>(modulo primitives)</p>



<a name="185779898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185779898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185779898">(Jan 16 2020 at 02:32)</a>:</h4>
<p>Adding an !Unpin to that type isn't going to do much anyway - that only affects behavior when interacting with Pin in the first place.</p>



<a name="185789198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185789198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> JP Sugarbroad <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185789198">(Jan 16 2020 at 06:23)</a>:</h4>
<p>Won't it change it so Pin&lt;Box&lt;z_stream&gt;&gt; works correctly?</p>



<a name="185789260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185789260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> JP Sugarbroad <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185789260">(Jan 16 2020 at 06:24)</a>:</h4>
<blockquote>
<p>like most sys crates basically have no "Rust" types in them</p>
</blockquote>
<p>What is <code>z_stream</code> then?</p>



<a name="185789360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185789360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185789360">(Jan 16 2020 at 06:27)</a>:</h4>
<p>note that whatever it is <code>links</code> really does in cargo.toml is under documented, and particularly you can link to a lib without a links entry.</p>



<a name="185807821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185807821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185807821">(Jan 16 2020 at 11:58)</a>:</h4>
<p>Links in cargo just means only one package in your crate graph with that key can exist</p>



<a name="185808253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185808253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185808253">(Jan 16 2020 at 12:05)</a>:</h4>
<p>z_stream is a direct transcription of the z_stream type in libz's header files.</p>



<a name="185846827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185846827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> JP Sugarbroad <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185846827">(Jan 16 2020 at 18:55)</a>:</h4>
<p>Perhaps I do not understand what you mean by "Rust" types.</p>



<a name="185861016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185861016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185861016">(Jan 16 2020 at 21:13)</a>:</h4>
<p>No types that are not C-compatible, basically</p>



<a name="185861031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185861031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185861031">(Jan 16 2020 at 21:14)</a>:</h4>
<p>i.e. repr(C)</p>



<a name="185861098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185861098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185861098">(Jan 16 2020 at 21:14)</a>:</h4>
<p>and essentially only primitives from std/core</p>



<a name="185861107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185861107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185861107">(Jan 16 2020 at 21:14)</a>:</h4>
<p>i.e., not String or CStr</p>



<a name="185917520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/rust-lang/libz-sys%2359/near/185917520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/rust-lang.2Flibz-sys.2359.html#185917520">(Jan 17 2020 at 13:57)</a>:</h4>
<p>or PhantomPinned</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>